<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_product_info" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="i_pro('')" type='success' size="mini"><i class='fa fa-check'></i>采购</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 设置采购周期 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品名称" prop="">
              {{s_product_info.product_name}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品型号" prop="">
              {{s_product_info.product_model}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品规格" prop="">
              {{s_product_info.product_norm}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="经济采购批量(/件)" prop="">
              {{s_product_info.economic_batch}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            {{s_product_info.economic_nuit}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="采购周期(/天)" prop="pm_cycle_set">
              <el-input v-model="s_product_info.pm_cycle_set" />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="purchaseDetileSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'PurchaseDetile',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_product_info: {
          product_name: null,
          product_model: null,
          product_norm: null,
          economic_batch: null,
          economic_nuit: null,
          pm_cycle_set: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/ProcureSupplyAction/purchaseDetile?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      purchaseDetileSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/psi/supplychainmana/ProcureSupplyAction/purchaseDetileSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/psi/supplychainmana/PurchaseList/purchaseList?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
      i_pro(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/psi/supplychainmana/ProcureSupplyAction/i_pro?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/psi/supplychainmana/PurchaseList/purchaseList?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
    },
  }
</script>
